package com.huaxin.hxcloud.activity;

import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;

import com.huaxin.common.BaseActivity;
import com.huaxin.hxcloud.R;
import com.huaxin.hxcloud.fragment.ModifyPassword1Fragment;
import com.huaxin.hxcloud.fragment.ModifyPassword2Fragment;

/**
 * Created by Administrator on 2017/1/10.
 */

public class ModifyPasswordActivity extends BaseActivity {;

    private  String phoneNum;
    @Override
    protected int getContentViewId() {
        return R.layout.activity_register;
    }

    @Override
    public void initView() {
        super.initView();
        Fragment fragment = new ModifyPassword1Fragment();
        getSupportFragmentManager().beginTransaction()
//                .setCustomAnimations(R.anim.slide_in_from_right, R.anim.slide_out_to_left,
//                        R.anim.slide_in_from_left, R.anim.slide_out_to_right)
                .replace(R.id.content,fragment)
                .addToBackStack(null)
                .commit();

    }

    public void nextStep(String phoneNum){
        setPhoneNum(phoneNum);
        Fragment fragment = new ModifyPassword2Fragment();
        getSupportFragmentManager().beginTransaction()
                .setCustomAnimations(R.anim.slide_in_from_right, R.anim.slide_out_to_left,
                        R.anim.slide_in_from_left, R.anim.slide_out_to_right)
                .replace(R.id.content,fragment)
                .addToBackStack(null)
                .commit();
    }

    @Override
    public void onBackPressed() {
        if(getSupportFragmentManager().getBackStackEntryCount()==1){
            finish();
        }else{
            super.onBackPressed();
        }
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public static void start(Context context) {
        context.startActivity(new Intent(context,ModifyPasswordActivity.class));

    }
}
